package com.angel.provider.health.impl;


import java.util.Date;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.SessionAttributes;

import com.angel.core.base.BaseProviderImpl;
import com.angel.dao.health.BuzMedicalContentMapper;
import com.angel.dao.health.BuzSubjectsMapper;
import com.angel.health.BuzSubjects;
import com.angel.provider.health.BuzSubjectsProvider;

@Service
public class BuzSubjectsProviderImpl extends BaseProviderImpl<BuzSubjects> implements BuzSubjectsProvider {

	@Autowired
	private BuzSubjectsMapper mapper;
	
	@Autowired
	private BuzMedicalContentMapper buzMedicalContentMapper;
	
	public BuzSubjects findById(Integer id) {
		return mapper.selectByPrimaryKey(id);
	}

	@Override
	@Transactional
	public int delById(BuzSubjects record) {
		
		Date date = new Date();
		record.setUpdateTime(date);
		record.setEnable(0);
		
		buzMedicalContentMapper.updateSetUnableBySubjectsId(null, date, record.getId());
		
		return mapper.updateByPrimaryKeySelective(record);
		
	}
	

}
